package com.talkweb.platform.commonapi.utils;

import com.talkweb.platform.commonapi.base.response.MessageResult;
import com.talkweb.platform.commonapi.base.response.Response;
import com.talkweb.platform.commonapi.constants.IStateCode;

public class ResultUtil {
	/**
	 * 服务调用异常
	 * 
	 * @return
	 */
	@SuppressWarnings("rawtypes")
	public static Response serviceException() {
		Response resp = new Response();
		MessageResult result = new MessageResult();
		result.setResultMsg("对不起，服务器异常，请联系相关责任人。");
		result.setResultCode(IStateCode.HTTP_450);
		resp.setServerResult(result);
		return resp;
	}

	public static <T> Response<T> responseResult(T t) {
		Response<T> resp = new Response<T>(t);
		MessageResult result = new MessageResult();
		result.setResultMsg("操作成功");
		result.setResultCode(IStateCode.HTTP_200);
		resp.setServerResult(result);
		return resp;
	}
}
